package com.sz.security.core.util;

import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.stp.SaTokenInfo;
import cn.dev33.satoken.stp.StpLogic;
import com.sz.security.config.LoginType;

public class StpWebUtil {
    public static final String TYPE = LoginType.WEB;

    public static StpLogic getStpLogic() {
        return SaManager.getStpLogic(TYPE);
    }

    public static void login(Object id) {
        getStpLogic().login(id);
    }

    public static void logout() {
        getStpLogic().logout();
    }

    public static boolean isLogin() {
        return getStpLogic().isLogin();
    }

    public static Object getLoginId() {
        return getStpLogic().getLoginId();
    }

    public static SaTokenInfo getTokenInfo() {
        return getStpLogic().getTokenInfo();
    }

    public static void checkPermission(String permission) {
        getStpLogic().checkPermission(permission);
    }
}